#include "../Mylog.h"

void test_log(const std::string& name)
{
    
    // mylog::DEBUG("%s", "测试");
    // mylog::INFO("%s", "测试");
    // mylog::WARN("%s", "测试");
    // mylog::ERROR("%s", "测试");
    // mylog::FATAL("%s", "测试");

    mylog::Logger::ptr logger = mylog::GetLogger(name);
    logger->debug("%s", "测试");
    logger->info("%s", "测试");
    logger->warn("%s", "测试");
    logger->error("%s", "测试");
    logger->fatal("%s", "测试");
}
int main()
{
    std::unique_ptr<mylog::LoggerBuilder> builder(new mylog::GlobalLoggerBuilder());
    builder->BuildLoggerLevel(mylog::LogLevel::value::WARN);
    builder->BuildLoggerName("async_logger");
    builder->BuildFormatter("[%c][%f:%l]%m%n");
    builder->BuildSink<mylog::StdoutSink>();
    builder->BuildSink<mylog::FileSink>("./logfile/async.log");
    builder->BuildSink<mylog::RollsizeSink>("./logfile/roll-async-by-size", 1024 * 1024);
    builder->BuildLoggerType(mylog::LoggerType::LOGGER_ASYNC);
    builder->Build();
    test_log("async_logger");
    return 0;
}